\documentclass[paper=a4, fontsize=11pt]{scrartcl} % A4 paper and 11pt font size

\usepackage[T1]{fontenc} % Use 8-bit encoding that has 256 glyphs
\usepackage{fourier} % Use the Adobe Utopia font for the document - comment this line to return to the LaTeX default
\usepackage[english]{babel} % English language/hyphenation
\usepackage{amsmath,amsfonts,amsthm} % Math packages
\usepackage[UTF8]{ctex}
\usepackage{graphicx}
\usepackage{float}
\usepackage[top=2cm, bottom=2cm, left=2cm, right=2cm]{geometry}
\usepackage[linesnumbered,boxed,lined,ruled]{algorithm2e}
\usepackage{algorithmicx}
\usepackage{algpseudocode}

\usepackage{xcolor}
\usepackage[framed,numbered,autolinebreaks,useliterate]{mcode}
\usepackage{listings}

\usepackage{sectsty} % Allows customizing section commands
\allsectionsfont{\centering \normalfont\scshape} % Make all sections centered, the default font and small caps

\usepackage{fancyhdr} % Custom headers and footers
\pagestyle{fancyplain} % Makes all pages in the document conform to the custom headers and footers
\fancyhead{} % No page header - if you want one, create it in the same way as the footers below
\fancyfoot[L]{} % Empty left footer
\fancyfoot[C]{} % Empty center footer
\fancyfoot[R]{\thepage} % Page numbering for right footer
\renewcommand{\headrulewidth}{0pt} % Remove header underlines
\renewcommand{\footrulewidth}{0pt} % Remove footer underlines
\setlength{\headheight}{13.6pt} % Customize the height of the header

\numberwithin{equation}{section} % Number equations within sections (i.e. 1.1, 1.2, 2.1, 2.2 instead of 1, 2, 3, 4)
\numberwithin{figure}{section} % Number figures within sections (i.e. 1.1, 1.2, 2.1, 2.2 instead of 1, 2, 3, 4)
\numberwithin{table}{section} % Number tables within sections (i.e. 1.1, 1.2, 2.1, 2.2 instead of 1, 2, 3, 4)

\setlength\parindent{0pt} % Removes all indentation from paragraphs - comment this line for an assignment with lots of text

%----------------------------------------------------------------------------------------
%	TITLE SECTION
%----------------------------------------------------------------------------------------

\newcommand{\horrule}[1]{\rule{\linewidth}{#1}} % Create horizontal rule command with 1 argument of height

\title{
\normalfont \normalsize
\textsc{中国科学院大学   计算机与控制学院} \\ [25pt] % Your university, school and/or department name(s)
\horrule{0.5pt} \\[0.4cm] % Thin top horizontal rule
\huge 随机过程第十次作业 \\ % The assignment title
\horrule{2pt} \\[0.5cm] % Thick bottom horizontal rule
}
\author{黎吉国&201618013229046} % Your name
%\date{\normalsize Nov 8,2016}

\begin{document}

\maketitle % Print the title

\newpage
\section{马尔科夫链}
\begin{enumerate}
  \item (一维带吸收壁的随机游动)一质点沿着标有整数的直线上游动，整数点的范围是$0,1,2...m$,经过一步自点$i$转移到$i-1$的概率是$p$,
  留在点$i$的概率是$q$，移到点$i+1$的概率是$r$，且$p+q+r=1$，其中$0,m$为吸收态，求一步转移矩阵。\\
  \textbf{解：}\\
  易知这是一个齐次马尔科夫链，其一步转移概率为
  \[
  \begin{split}
    p_{i,i+1}&=q \qquad \mbox{$1\le i\le m-1$}\\
    p_{i,i-1}&=q \qquad \mbox{$1\le i \le m-1$}\\
    p_{i,i} &= r \qquad \mbox{$1\le i \le m-1$}\\
    p_{0,0} &= p_{m,m} = 1 \qquad \mbox{}\\
  \end{split}
  \]
  其中状态$i$为马尔科夫链的吸收态的充要条件是$p_{ii}=1$.\\
  可得
  \[
  P=\left (
  \begin{array}{rrrrrrrrr}
      1&0&0&0&0&\ldots&\ldots&\ldots&\ldots\\
      p&q&r&0&0&\ldots&\ldots&\ldots&\ldots\\
      0&p&q&r&0&\ldots&\ldots&\ldots&\ldots\\
      \vdots&\vdots&\vdots&\vdots&\vdots&\ddots&\vdots&\vdots&\vdots\\
      \cdots&\cdots&\cdots&\cdots&\cdots&0&p&q&r\\
      \cdots&\cdots&\cdots&\cdots&\cdots&0&0&0&1\\
  \end{array}
  \right)
  \]
  矩阵的大小为$m+1\times m+1$。
  \item (证明一个随机变量是马尔科夫链)$\{ X(n),n=1,2,\ldots \}$是相同独立同分布的随机变量序列，令
  \[ Y(n)=\sum_{k=1}^{n} X(k)\qquad n=1,2,\ldots \]
  请证明$\{ X(n),n=1,2,\ldots \}$是伯努利随机变量时，$Y(n)$是马尔科夫链。
  \\
  \textbf{解：}\\
  根据马尔科夫随机过程的定义，我们需要证明对任取的时刻$0<m_1<m_2<\ldots<m_n$以及$ 1 \le k\le n-1$
  有
  \[
   P\{ Y(m_n)=i_n | Y(m_1)=i_1,\ldots,Y(m_{n-1}) \}=P\{ Y(m_n)=i_n|Y(m_{n-1})=i_{n-1} \}
  \]
  \textbf{证明：}\\
  \[
  \begin{split}
  &P\{ Y(m_n)=i_n | Y(m_1)=i_1,\ldots,Y(m_{n-1}) \}\\
  =& P\{ \sum_{k=1}^{m_n}X(k)=i_n | \sum_{k=1}^{m_1}X(k)=i_1,\ldots,\sum_{k=1}^{m_{n-1}}X(k)=i_{n-1} \}\\
  =& P\{ \sum_{k=m_{n-1}+1}^{m_n}X(k)=i_n-i_{n-1} | \sum_{k=1}^{m_1}X(k)=i_1,\sum_{k=m_1 +1}^{m_2}X(k)=i_2-i_1,\ldots,\sum_{k=m_{n-2}}^{m_{n-1}}X(k)=i_{n-1}-i_{n-2} \}\\
  =& P\{ \sum_{k=m_{n-1}+1}^{m_n}X(k)=i_n-i_{n-1} \}\\
  \end{split}
  \]
  \[
  \begin{split}
  &P\{ Y(m_n)=i_n|Y(m_{n-1})=i_{n-1}\\
  =&P\{ \sum_{k=1}^{m_n}X(k)=i_n | \sum_{k=1}^{m_1}X(k)=i_1 \}\\
  =&P\{ \sum_{k=m_{n-1}+1}^{m_n}X(k)=i_n-i_{n-1} | \sum_{k=1}^{m_{n-1}}X(k)=i_1 \}\\
  =& P\{ \sum_{k=m_{n-1}+1}^{m_n}X(k)=i_n-i_{n-1} \}\\
  &P\{ Y(m_n)=i_n | Y(m_1)=i_1,\ldots,Y(m_{n-1}) \}=P\{ Y(m_n)=i_n|Y(m_{n-1})=i_{n-1} \}=P\{ \sum_{k=m_{n-1}+1}^{m_n}X(k)=i_n-i_{n-1} \}\\
\end{split}
  \]
  然后证明其实齐次的，需要证明$p_{ij}(s,t)=p_{ij}$,与起始时刻无关\\
  \[
  \begin{split}
  p_{ij}(n,k)&=P\{ Y(k)=j|Y(n)=i \}\\
  &=P\{ Y(k)-Y(n)=j-i|Y(n)=i \}\\
  &=P\{ Y(k)-Y(n)=j-i \}
\end{split}
  \]
  \textbf{得证.}
  \item
  在天气预报中，若今日是否下雨依赖于前两天的天气情况，我们做如下假定，昨日今日都下雨，明日有雨的概率为$0.7$，昨日无雨今日有雨
  明日下雨的概率为$0.5$，昨日有雨，今日无雨，明日下雨的概率为0.4，昨日今日都无雨，明日下雨的概率为0.2，问该问题
  是否可以用一个markov链表示，若可以求在星期一星期二都下雨的条件下，周四下雨的概率。
  \\
  \textbf{解：}\\
  记状态$I=\{0,1,2,3\}$分别表示昨天今天都下雨，昨天下雨今天无雨，昨天无雨今天下雨，和昨天今天都无雨四种状态，
  $X(t)$表示$t$时刻的天气状况，由题意可知，$X(t)$只与$X(t-1)$有关，从而$\{ X(t),t\in\mathcal{N} \}$
  是一个Markov链，其一步转移矩阵为：
  \[
  P=\left (
  \begin{array}{rrrr}
    0.7&0.3&0&0\\
    0&0&0.4&0.6\\
    0.5&0.5&0&0\\
    0&0&0.2&0.8
  \end{array}
  \right)
  \]
  这里我们需要求两步转移矩阵
  \[
  P^{(2)}=P^2=\left (
  \begin{array}{rrrr}
    0.49&0.21&0.12&0.18\\
    0.20&0.20&0.12&0.48\\
    0.35&0.15&0.20&0.30\\
    0.10&0.10&0.16&0.64
  \end{array}
  \right)
  \]
  周四下雨对应的状态是“周三周四都下雨”和“周三不下雨，周四下雨”，对应于状态0和状(态2
  \[ P\{X(n+2)\in \{ 0,2 \})|X(n)=0 \}=P^{(2)}(0,0)+P^{(2)}(0,3)=0.49+0.12=0.61 \]
\end{enumerate}

\end{document}
